package com.jia.videos.controller;

import com.jia.videos.common.lang.R;
import com.jia.videos.entity.VideoShow;
import com.jia.videos.service.VideoShowService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/videos/index")
@CrossOrigin
@Api(tags = "首页管理")
public class IndexRecommendController {

    @Autowired
    VideoShowService videoShowService;

    @GetMapping("banner")
    public R banner() {
        List<VideoShow> list = videoShowService.getIndexBanner();
        return R.ok().data("data",list);
    }

    @GetMapping("recommend")
    public R recommend() {
        List<VideoShow> list = videoShowService.getRecommend();
        return R.ok().data("data",list);
    }

    @GetMapping("movie")
    public R movie() {
        List<VideoShow> list = videoShowService.getIndexMovie();
        return R.ok().data("data",list);
    }

    @GetMapping("television")
    public R television() {
        List<VideoShow> list = videoShowService.getIndexTelevision();
        return R.ok().data("data",list);
    }

    @GetMapping("category/{categoryId}")
    public R category(@PathVariable Long categoryId) {
        List<VideoShow> list = videoShowService.getIndexCategory(categoryId);
        return R.ok().data("data",list);
    }

    @GetMapping("hot")
    public R hot() {
        List<VideoShow> list = videoShowService.getIndexHot();
        return R.ok().data("data",list);
    }

}
